package com.projectsierra.springappengine;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Logger;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;

public class UstalCene extends  HttpServlet{
	private static final Logger log = Logger.getLogger(UstalCene.class.getName());
	@Override
	public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException
	{
		DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();

	 	Entity rekord = new Entity("CenaPaliwa", "cPaliwa");
		rekord.setProperty("E95", req.getParameter("pb95"));
		rekord.setProperty("E98", req.getParameter("pb98"));
		rekord.setProperty("ON", req.getParameter("on"));
		rekord.setProperty("LPG", req.getParameter("lpg"));
		datastore.put(rekord);
		
		resp.sendRedirect("/Prices");
		
	}
	
}
